package com.icinfo.cloud.provider.punish.ucase.app.controller;


import com.icinfo.cloud.provider.punish.approval.dto.ApprovalGeneralSubmitDto;
import com.icinfo.cloud.provider.punish.approval.service.ICaseApprovalWaitRecordService;
import com.icinfo.cloud.provider.punish.ucase.app.controller.service.AppCaseClosingApprovalService;
import com.icinfo.framework.common.web.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


/**
 * app结案审批
 */
@Slf4j
@RestController
@RequestMapping("/appCaseClosingApprova")
public class AppCaseClosingApprovalController {


    /**
     * 暂不使用该service层
     */
    @Autowired
    private AppCaseClosingApprovalService appCaseClosingApprovalService;

    /**
     * 现PC端结案提交流程的service层
     */
    @Autowired
    private ICaseApprovalWaitRecordService caseApprovalWaitRecordService;

    /**
     * 通用提交审批接口，该文书需要审批调用
     * @param
     * @return
     */
    @PostMapping("/documentGeneralSubmit")
    public Result documentGeneralSubmit(@Validated @RequestBody ApprovalGeneralSubmitDto dto){
        Map<String,Object> result = caseApprovalWaitRecordService.documentGeneralSubmit(dto.getCaseId(),dto.getDocumentCatalogCode(),dto.getNextHandler(),dto.getOpinion(),dto.getPartyId(),dto.getCaseAssistId(),dto.getIsAutoApproval(),dto.getAutoTime(),dto.getDocId(),dto.getIsEditApproval());
        if(result.size() > 1){
            return Result.success("操作成功！",result);
        }
        return Result.error("操作失败！");
    }

}
